/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.library.forms;

import static java.awt.image.ImageObserver.WIDTH;
import java.util.ArrayList;
import javax.swing.JOptionPane;

/**
 *
 * @author Meron
 */
public class MainForm extends javax.swing.JFrame {
 private String pubTilte;
 private String pubIsbn;
 private String autherName;
 private String pubDate;
 private String pubCompany;
 private int numberOfCopy;
 private int issueNumber;
 private ArrayList<Copy> myCopyList;
 Member myMember;
 Publication myBook;
 Publication myMegazin;
 Publication myPublication;
 
 private String LoonissueDate;
 private String LoonDueDate;
 private HistoryLon myHistory;
 
 
 
 private String fName;
 private String lName;
 private String address;
 private String pNumber;
 private ArrayList<Reservation> myReservationList;
 private ArrayList<Loan> myLoan;

 private ArrayList<Member> myMemberList;
 
 private Member LonedMember;
 private Copy LonedCopy;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
    public MainForm() {
        initComponents();
        MagazineIsuue.setVisible(false);
        MagazinIssueText.setVisible(false);
        myCopyList=new ArrayList<Copy>();
        myMemberList=new ArrayList<Member>();
        myReservationList=new ArrayList<Reservation>();
        myLoan=new ArrayList<Loan>();
        ReserveButton.setVisible(false);
        setLocation(400,200);
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        jPanel2 = new javax.swing.JPanel();
        jTabbedPane1 = new javax.swing.JTabbedPane();
        jPanel5 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        typePublicationComboBox = new javax.swing.JComboBox();
        jLabel2 = new javax.swing.JLabel();
        publicationTitleTextField = new javax.swing.JTextField();
        jLabel7 = new javax.swing.JLabel();
        publicationAutherTextField = new javax.swing.JTextField();
        jLabel8 = new javax.swing.JLabel();
        publicationTextField = new javax.swing.JTextField();
        jLabel9 = new javax.swing.JLabel();
        ISBNTextField = new javax.swing.JTextField();
        addPublicationButton = new javax.swing.JButton();
        datePublicationTextField = new javax.swing.JTextField();
        jLabel14 = new javax.swing.JLabel();
        jLabel15 = new javax.swing.JLabel();
        copyNPublicationTextField = new javax.swing.JTextField();
        MagazinIssueText = new javax.swing.JTextField();
        MagazineIsuue = new javax.swing.JLabel();
        jPanel3 = new javax.swing.JPanel();
        jPanel4 = new javax.swing.JPanel();
        jLabel6 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        PhoneNumberTextBox = new javax.swing.JTextField();
        memberAddressTextBox = new javax.swing.JTextField();
        jLabel3 = new javax.swing.JLabel();
        firstNameTextBox = new javax.swing.JTextField();
        jLabel4 = new javax.swing.JLabel();
        addMemberButton = new javax.swing.JButton();
        jLabel16 = new javax.swing.JLabel();
        generatedIdLable = new javax.swing.JLabel();
        lastNameTextBox = new javax.swing.JTextField();
        jPanel6 = new javax.swing.JPanel();
        jLabel10 = new javax.swing.JLabel();
        issueLable = new javax.swing.JLabel();
        jLabel12 = new javax.swing.JLabel();
        jLabel13 = new javax.swing.JLabel();
        RegistrationIssueDateTextField = new javax.swing.JTextField();
        RegistrationNameTextField = new javax.swing.JTextField();
        RegBookTitleTextField = new javax.swing.JTextField();
        RegDueDateTextField = new javax.swing.JTextField();
        RegResservationButton = new javax.swing.JButton();
        jLabel17 = new javax.swing.JLabel();
        MemberIdTextField = new javax.swing.JTextField();
        jLabel18 = new javax.swing.JLabel();
        RegLastNameTextField1 = new javax.swing.JTextField();
        jLabel19 = new javax.swing.JLabel();
        RegCopyTextField = new javax.swing.JTextField();
        jLabel20 = new javax.swing.JLabel();
        RegAddressTextField = new javax.swing.JTextField();
        RegAuthorTextField = new javax.swing.JTextField();
        jLabel21 = new javax.swing.JLabel();
        jLabel22 = new javax.swing.JLabel();
        RegPublicationTypeComboBox = new javax.swing.JComboBox();
        RegAvilablityButton = new javax.swing.JButton();
        ReserveButton = new javax.swing.JButton();
        jPanel7 = new javax.swing.JPanel();
        jLabel11 = new javax.swing.JLabel();
        HistoryUserId = new javax.swing.JTextField();
        ShowButton = new javax.swing.JButton();
        historyLable = new javax.swing.JLabel();
        ClearButton = new javax.swing.JButton();
        jLabel23 = new javax.swing.JLabel();
        jLabel24 = new javax.swing.JLabel();
        jLabel25 = new javax.swing.JLabel();
        jLabel26 = new javax.swing.JLabel();
        jLabel27 = new javax.swing.JLabel();
        BookHistoryLabel = new javax.swing.JLabel();
        MemberHistoryLabel = new javax.swing.JLabel();
        BookAuthorHistoryLabel = new javax.swing.JLabel();
        IssueDateHisoryLabel = new javax.swing.JLabel();
        jLabel28 = new javax.swing.JLabel();
        DueDateHisoryLablee = new javax.swing.JLabel();
        membNameLable = new javax.swing.JLabel();
        MemberNameLabelHistory = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 0, Short.MAX_VALUE)
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 0, Short.MAX_VALUE)
        );

        jLabel1.setText("Type");

        typePublicationComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Book", "Magazine" }));
        typePublicationComboBox.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                typePublicationComboBoxActionPerformed(evt);
            }
        });

        jLabel2.setText("Title");

        jLabel7.setText("Author");

        publicationAutherTextField.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                publicationAutherTextFieldActionPerformed(evt);
            }
        });

        jLabel8.setText("Publisher");

        jLabel9.setText("ISBN");

        addPublicationButton.setText("Add");
        addPublicationButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                addPublicationButtonActionPerformed(evt);
            }
        });

        jLabel14.setText("Date");

        jLabel15.setText("CopyNumber");

        copyNPublicationTextField.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                copyNPublicationTextFieldActionPerformed(evt);
            }
        });

        MagazinIssueText.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                MagazinIssueTextActionPerformed(evt);
            }
        });

        MagazineIsuue.setText("Megazien Isuue Number");

        javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
        jPanel5.setLayout(jPanel5Layout);
        jPanel5Layout.setHorizontalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel5Layout.createSequentialGroup()
                        .addContainerGap()
                        .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel5Layout.createSequentialGroup()
                                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addComponent(jLabel9, javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel5Layout.createSequentialGroup()
                                        .addGap(5, 5, 5)
                                        .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                        .addComponent(publicationTitleTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 77, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addGap(0, 0, Short.MAX_VALUE)))
                                .addGap(213, 213, 213))
                            .addGroup(jPanel5Layout.createSequentialGroup()
                                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(addPublicationButton, javax.swing.GroupLayout.PREFERRED_SIZE, 78, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addGroup(jPanel5Layout.createSequentialGroup()
                                        .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addGap(18, 18, 18)
                                        .addComponent(typePublicationComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                                .addGap(0, 0, Short.MAX_VALUE))
                            .addGroup(jPanel5Layout.createSequentialGroup()
                                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addComponent(ISBNTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 74, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addGroup(jPanel5Layout.createSequentialGroup()
                                        .addComponent(jLabel7)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                        .addComponent(publicationAutherTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 77, javax.swing.GroupLayout.PREFERRED_SIZE)))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jLabel15)
                                    .addComponent(jLabel8))
                                .addGap(55, 55, 55))
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel5Layout.createSequentialGroup()
                                .addGap(0, 0, Short.MAX_VALUE)
                                .addComponent(jLabel14)
                                .addGap(84, 84, 84))))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel5Layout.createSequentialGroup()
                        .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(MagazineIsuue)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)))
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(publicationTextField, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 74, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(copyNPublicationTextField, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 74, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(datePublicationTextField, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 74, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(MagazinIssueText, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 74, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(261, Short.MAX_VALUE))
        );
        jPanel5Layout.setVerticalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addGap(18, 18, 18)
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(jPanel5Layout.createSequentialGroup()
                        .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel1)
                            .addComponent(typePublicationComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel2)
                            .addComponent(publicationTitleTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18)
                        .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel9)
                            .addComponent(ISBNTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel7)
                            .addComponent(publicationAutherTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 131, Short.MAX_VALUE)
                        .addComponent(addPublicationButton, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(77, 77, 77))
                    .addGroup(jPanel5Layout.createSequentialGroup()
                        .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(datePublicationTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel14))
                        .addGap(18, 18, 18)
                        .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(publicationTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel8))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(copyNPublicationTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel15))
                        .addGap(18, 18, 18)
                        .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(MagazinIssueText, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(MagazineIsuue))
                        .addGap(207, 207, 207))))
        );

        jTabbedPane1.addTab("Add Publication", jPanel5);

        jLabel6.setText("Phone Number");

        jLabel5.setText("Address");

        PhoneNumberTextBox.setName("firstNameTextBox"); // NOI18N
        PhoneNumberTextBox.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                PhoneNumberTextBoxActionPerformed(evt);
            }
        });

        memberAddressTextBox.setName("firstNameTextBox"); // NOI18N
        memberAddressTextBox.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                memberAddressTextBoxActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel4Layout.createSequentialGroup()
                        .addContainerGap(34, Short.MAX_VALUE)
                        .addComponent(jLabel5)
                        .addGap(35, 35, 35))
                    .addGroup(jPanel4Layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jLabel6)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(PhoneNumberTextBox, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(memberAddressTextBox, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(34, 34, 34))
        );
        jPanel4Layout.setVerticalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addGap(17, 17, 17)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel6)
                    .addComponent(PhoneNumberTextBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(memberAddressTextBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel5))
                .addContainerGap(31, Short.MAX_VALUE))
        );

        jLabel3.setText("Fist Name:");

        firstNameTextBox.setName("firstNameTextBox"); // NOI18N
        firstNameTextBox.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                firstNameTextBoxActionPerformed(evt);
            }
        });

        jLabel4.setText("Last Name:");

        addMemberButton.setText("Add");
        addMemberButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                addMemberButtonActionPerformed(evt);
            }
        });

        jLabel16.setText("Generated Id:");

        generatedIdLable.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N

        lastNameTextBox.setName("firstNameTextBox"); // NOI18N
        lastNameTextBox.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                lastNameTextBoxActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jLabel16, javax.swing.GroupLayout.PREFERRED_SIZE, 72, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(115, 115, 115)
                        .addComponent(generatedIdLable, javax.swing.GroupLayout.PREFERRED_SIZE, 82, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addGap(72, 72, 72)
                        .addComponent(addMemberButton, javax.swing.GroupLayout.PREFERRED_SIZE, 104, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addGap(24, 24, 24)
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel4)
                            .addComponent(jLabel3))
                        .addGap(34, 34, 34)
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(lastNameTextBox, javax.swing.GroupLayout.PREFERRED_SIZE, 96, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(firstNameTextBox, javax.swing.GroupLayout.PREFERRED_SIZE, 96, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18)
                        .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(200, Short.MAX_VALUE))
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addGap(28, 28, 28)
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel3)
                            .addComponent(firstNameTextBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel3Layout.createSequentialGroup()
                                .addGap(31, 31, 31)
                                .addComponent(jLabel4))
                            .addGroup(jPanel3Layout.createSequentialGroup()
                                .addGap(18, 18, 18)
                                .addComponent(lastNameTextBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(25, 25, 25)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel16, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(generatedIdLable, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(64, 64, 64)
                .addComponent(addMemberButton, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(108, Short.MAX_VALUE))
        );

        jTabbedPane1.addTab("Add Member", jPanel3);

        jLabel10.setText("First Name");

        issueLable.setText("Issue Date");

        jLabel12.setText(" Title");

        jLabel13.setText("Due Date");

        RegistrationIssueDateTextField.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                RegistrationIssueDateTextFieldActionPerformed(evt);
            }
        });

        RegistrationNameTextField.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                RegistrationNameTextFieldActionPerformed(evt);
            }
        });

        RegBookTitleTextField.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                RegBookTitleTextFieldActionPerformed(evt);
            }
        });

        RegDueDateTextField.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                RegDueDateTextFieldActionPerformed(evt);
            }
        });

        RegResservationButton.setText("Borrow");
        RegResservationButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                RegResservationButtonActionPerformed(evt);
            }
        });

        jLabel17.setText("MemberID");

        MemberIdTextField.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                MemberIdTextFieldActionPerformed(evt);
            }
        });

        jLabel18.setText("Last Name");

        RegLastNameTextField1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                RegLastNameTextField1ActionPerformed(evt);
            }
        });

        jLabel19.setText("CopyNumber:");

        jLabel20.setText("Address");

        RegAddressTextField.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                RegAddressTextFieldActionPerformed(evt);
            }
        });

        RegAuthorTextField.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                RegAuthorTextFieldActionPerformed(evt);
            }
        });

        jLabel21.setText("Authour");

        jLabel22.setText("Publication Type");

        RegPublicationTypeComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Book", "Magazine" }));

        RegAvilablityButton.setText("Avaliblity");
        RegAvilablityButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                RegAvilablityButtonActionPerformed(evt);
            }
        });

        ReserveButton.setText("Reserve");
        ReserveButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                ReserveButtonActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6);
        jPanel6.setLayout(jPanel6Layout);
        jPanel6Layout.setHorizontalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel6Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel6Layout.createSequentialGroup()
                        .addComponent(jLabel17)
                        .addGap(634, 634, 634))
                    .addGroup(jPanel6Layout.createSequentialGroup()
                        .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel10)
                            .addComponent(jLabel20)
                            .addComponent(jLabel18))
                        .addGap(48, 48, 48)
                        .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel6Layout.createSequentialGroup()
                                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(MemberIdTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 85, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(RegistrationNameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 85, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGap(0, 0, Short.MAX_VALUE))
                            .addGroup(jPanel6Layout.createSequentialGroup()
                                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                    .addComponent(RegAddressTextField, javax.swing.GroupLayout.DEFAULT_SIZE, 85, Short.MAX_VALUE)
                                    .addComponent(RegLastNameTextField1))
                                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(jPanel6Layout.createSequentialGroup()
                                        .addGap(157, 157, 157)
                                        .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addComponent(jLabel22)
                                            .addComponent(jLabel12)
                                            .addComponent(jLabel19, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                                    .addGroup(jPanel6Layout.createSequentialGroup()
                                        .addGap(160, 160, 160)
                                        .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addComponent(jLabel13)
                                            .addComponent(jLabel21)
                                            .addComponent(issueLable))))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(RegCopyTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 97, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(RegAuthorTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 97, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(RegPublicationTypeComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 104, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(RegDueDateTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 97, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(RegistrationIssueDateTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 97, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addGroup(jPanel6Layout.createSequentialGroup()
                                        .addComponent(RegBookTitleTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 97, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addGap(26, 26, 26)
                                        .addComponent(RegAvilablityButton, javax.swing.GroupLayout.PREFERRED_SIZE, 87, javax.swing.GroupLayout.PREFERRED_SIZE)))
                                .addGap(0, 2, Short.MAX_VALUE)))
                        .addGap(242, 242, 242))))
            .addGroup(jPanel6Layout.createSequentialGroup()
                .addGap(150, 150, 150)
                .addComponent(RegResservationButton, javax.swing.GroupLayout.PREFERRED_SIZE, 85, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(108, 108, 108)
                .addComponent(ReserveButton)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jPanel6Layout.setVerticalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel6Layout.createSequentialGroup()
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel6Layout.createSequentialGroup()
                        .addContainerGap()
                        .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel6Layout.createSequentialGroup()
                                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(jLabel17)
                                    .addComponent(MemberIdTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGap(18, 18, 18)
                                .addComponent(jLabel10)
                                .addGap(14, 14, 14))
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel6Layout.createSequentialGroup()
                                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(jLabel22)
                                    .addComponent(RegPublicationTypeComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGap(18, 18, 18)
                                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(jLabel12, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(RegBookTitleTextField)
                                    .addComponent(RegAvilablityButton))
                                .addGap(26, 26, 26))))
                    .addGroup(jPanel6Layout.createSequentialGroup()
                        .addGap(58, 58, 58)
                        .addComponent(RegistrationNameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(3, 3, 3)))
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(RegLastNameTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(RegCopyTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel19))
                    .addComponent(jLabel18))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel20)
                    .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(RegAddressTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(RegAuthorTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel21)))
                .addGap(18, 18, 18)
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel13)
                    .addComponent(RegDueDateTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(19, 19, 19)
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(RegistrationIssueDateTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(issueLable))
                .addGap(40, 40, 40)
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(ReserveButton, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(RegResservationButton, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(83, 83, 83))
        );

        jTabbedPane1.addTab("Borrow", jPanel6);

        jLabel11.setText("User Id");

        HistoryUserId.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                HistoryUserIdActionPerformed(evt);
            }
        });

        ShowButton.setText("Show History");
        ShowButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                ShowButtonActionPerformed(evt);
            }
        });

        historyLable.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N

        ClearButton.setText("Clear");
        ClearButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                ClearButtonActionPerformed(evt);
            }
        });

        jLabel23.setText("Member Name");

        jLabel24.setText("Book Name");

        jLabel25.setText("Book Author");

        jLabel26.setText("Issue Date");

        jLabel27.setText("Due Date");

        javax.swing.GroupLayout jPanel7Layout = new javax.swing.GroupLayout(jPanel7);
        jPanel7.setLayout(jPanel7Layout);
        jPanel7Layout.setHorizontalGroup(
            jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel7Layout.createSequentialGroup()
                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel7Layout.createSequentialGroup()
                        .addGap(170, 170, 170)
                        .addComponent(ClearButton, javax.swing.GroupLayout.PREFERRED_SIZE, 69, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel7Layout.createSequentialGroup()
                        .addGap(28, 28, 28)
                        .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addGroup(jPanel7Layout.createSequentialGroup()
                                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addComponent(jLabel11, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jLabel23))
                                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(jPanel7Layout.createSequentialGroup()
                                        .addGap(33, 33, 33)
                                        .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addComponent(BookHistoryLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 85, javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addGroup(jPanel7Layout.createSequentialGroup()
                                                .addComponent(membNameLable)
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                .addComponent(MemberHistoryLabel)
                                                .addGap(28, 28, 28)
                                                .addComponent(MemberNameLabelHistory, javax.swing.GroupLayout.PREFERRED_SIZE, 61, javax.swing.GroupLayout.PREFERRED_SIZE))))
                                    .addGroup(jPanel7Layout.createSequentialGroup()
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(HistoryUserId, javax.swing.GroupLayout.PREFERRED_SIZE, 75, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addGap(43, 43, 43)
                                        .addComponent(ShowButton, javax.swing.GroupLayout.PREFERRED_SIZE, 118, javax.swing.GroupLayout.PREFERRED_SIZE)))
                                .addGap(130, 130, 130))
                            .addGroup(jPanel7Layout.createSequentialGroup()
                                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addComponent(jLabel25, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(jLabel24, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(jLabel26, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(jLabel27, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(jPanel7Layout.createSequentialGroup()
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(jLabel28)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel7Layout.createSequentialGroup()
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                        .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addComponent(BookAuthorHistoryLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 56, javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                                .addComponent(DueDateHisoryLablee, javax.swing.GroupLayout.DEFAULT_SIZE, 60, Short.MAX_VALUE)
                                                .addComponent(IssueDateHisoryLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                                        .addGap(221, 221, 221)))))
                        .addComponent(historyLable, javax.swing.GroupLayout.PREFERRED_SIZE, 167, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(45, Short.MAX_VALUE))
        );
        jPanel7Layout.setVerticalGroup(
            jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel7Layout.createSequentialGroup()
                .addGap(39, 39, 39)
                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addGroup(jPanel7Layout.createSequentialGroup()
                        .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel11, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(HistoryUserId, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(ShowButton))
                        .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel7Layout.createSequentialGroup()
                                .addGap(46, 46, 46)
                                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(jLabel23)
                                    .addComponent(MemberHistoryLabel)
                                    .addComponent(membNameLable)))
                            .addGroup(jPanel7Layout.createSequentialGroup()
                                .addGap(29, 29, 29)
                                .addComponent(MemberNameLabelHistory, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addGap(18, 18, 18)
                        .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel24)
                            .addComponent(BookHistoryLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                    .addComponent(historyLable, javax.swing.GroupLayout.PREFERRED_SIZE, 115, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel25)
                    .addComponent(BookAuthorHistoryLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(26, 26, 26)
                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(jLabel26, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(IssueDateHisoryLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addGap(18, 18, 18)
                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel27)
                    .addComponent(jLabel28)
                    .addComponent(DueDateHisoryLablee, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(67, 67, 67)
                .addComponent(ClearButton)
                .addContainerGap(28, Short.MAX_VALUE))
        );

        jTabbedPane1.addTab("History", jPanel7);

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 683, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void firstNameTextBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_firstNameTextBoxActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_firstNameTextBoxActionPerformed

    private void lastNameTextBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_lastNameTextBoxActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_lastNameTextBoxActionPerformed

    private void memberAddressTextBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_memberAddressTextBoxActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_memberAddressTextBoxActionPerformed

    private void PhoneNumberTextBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_PhoneNumberTextBoxActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_PhoneNumberTextBoxActionPerformed

    private void addMemberButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addMemberButtonActionPerformed
      
       fName=firstNameTextBox.getText();
       lName=lastNameTextBox.getText();
       address=memberAddressTextBox.getText();
       pNumber=PhoneNumberTextBox.getText();
       myMember=new Member(fName,lName,address,pNumber);
               myMemberList.add(myMember);

       generatedIdLable.setText(""+myMember.getId());
      JOptionPane.showMessageDialog(this, "Memeber is Addded ",null, WIDTH);
       clearMember();
        // TODO add your handling code here:
    }//GEN-LAST:event_addMemberButtonActionPerformed

    public void clearMember()
    {
    firstNameTextBox.setText("");
      lastNameTextBox.setText("");
       memberAddressTextBox.setText("");
       PhoneNumberTextBox.setText("");
        generatedIdLable.setText("");
        
    
    }
    
    
    
    private void publicationAutherTextFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_publicationAutherTextFieldActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_publicationAutherTextFieldActionPerformed

    private void RegistrationNameTextFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_RegistrationNameTextFieldActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_RegistrationNameTextFieldActionPerformed

    private void RegistrationIssueDateTextFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_RegistrationIssueDateTextFieldActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_RegistrationIssueDateTextFieldActionPerformed

    private void RegBookTitleTextFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_RegBookTitleTextFieldActionPerformed
    String title;
    Copy myCopy;
    title=RegBookTitleTextField.getText();
     myCopy=searchCopy(title); 
      if(myCopy!=null)
      {
      RegCopyTextField.setText(""+myCopy.getCopyId());
            RegAuthorTextField.setText(""+myCopy.getMyPub().getAuthor()); 
       
          
      
      }
        
        
        // TODO add your handling code here:
    }//GEN-LAST:event_RegBookTitleTextFieldActionPerformed

    
   public Copy searchCopy(String Title)
    
   {
       Copy myCopy=null;
       for(Copy c:myCopyList)
       {
       if(Title.equalsIgnoreCase(c.getMyPub().getTitle())&&c.isIsAvailable()==true)
       {
        myCopy=c;
       }
       else
       {
       myCopy=null;
       
       }
       }
       return myCopy;   
   }
    
    
    private void RegDueDateTextFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_RegDueDateTextFieldActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_RegDueDateTextFieldActionPerformed

    private void copyNPublicationTextFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_copyNPublicationTextFieldActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_copyNPublicationTextFieldActionPerformed

    private void addPublicationButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addPublicationButtonActionPerformed
        pubTilte=publicationTitleTextField.getText();
        pubIsbn=ISBNTextField.getText();
       autherName=publicationAutherTextField.getText();
       pubDate=datePublicationTextField.getText();
       pubCompany=publicationTextField.getText();
       numberOfCopy=(int)Integer.parseInt(copyNPublicationTextField.getText());
       
       if(typePublicationComboBox.getSelectedItem().toString().equalsIgnoreCase("Book"))
       {
       Publication myBook=new Book(pubTilte,pubIsbn,autherName,pubDate,pubCompany,numberOfCopy); 
        for(int i=1;i<=numberOfCopy;i++)
        {
            myCopyList.add(new Copy(myBook,i));
           System.out.println(i+"copy Add");
        
        }
       
       
       }
       else
       {
           
           issueNumber= Integer.parseInt(MagazinIssueText.getText());
           
           //Magazin(int issueNumber, String editorName, String title, String date, String pubCompany, int copyN)
       myMegazin=new Magazin(issueNumber,autherName,pubTilte,pubDate,pubCompany,numberOfCopy); 
  for(int i=1;i<=numberOfCopy;i++)
        {
            myCopyList.add(new Copy(myMegazin,i));        
       }
       }
       JOptionPane.showMessageDialog(this, "Publication is Addded ",null, WIDTH);
       cleanAddPublication();
    }//GEN-LAST:event_addPublicationButtonActionPerformed

    private void MagazinIssueTextActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_MagazinIssueTextActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_MagazinIssueTextActionPerformed

    private void typePublicationComboBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_typePublicationComboBoxActionPerformed
       if(typePublicationComboBox.getSelectedItem().toString().equals("Magazine"))
       {
           MagazineIsuue.setVisible(true);
            MagazinIssueText.setVisible(true); 
       }
       else
       {
       MagazineIsuue.setVisible(false);
            MagazinIssueText.setVisible(false); 
       
       }
              // TODO add your handling code here:
    }//GEN-LAST:event_typePublicationComboBoxActionPerformed

    private void RegLastNameTextField1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_RegLastNameTextField1ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_RegLastNameTextField1ActionPerformed

    private void RegAddressTextFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_RegAddressTextFieldActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_RegAddressTextFieldActionPerformed

    private void RegAuthorTextFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_RegAuthorTextFieldActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_RegAuthorTextFieldActionPerformed

    private void MemberIdTextFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_MemberIdTextFieldActionPerformed
  
     int memberId; 
     //Member mebBorrower;
      memberId=Integer.parseInt(MemberIdTextField.getText());
        
       LonedMember=searchMember(memberId);
      if( LonedMember!=null)
      {
      RegistrationNameTextField.setText( LonedMember.getfName());
      RegLastNameTextField1.setText( LonedMember.getlName());
      RegAddressTextField.setText( LonedMember.getAddress());
            }
      else
      {
       JOptionPane.showMessageDialog(this,"There is no such Member ",null,WIDTH);
      
      
      }
      
      
      
      
        // TODO add your handling code here:
    }//GEN-LAST:event_MemberIdTextFieldActionPerformed

    private void RegAvilablityButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_RegAvilablityButtonActionPerformed
    
    String title;
    //Copy myCopy;
    title=RegBookTitleTextField.getText();
     LonedCopy=searchCopy(title); 
      if(LonedCopy!=null)
      {
       
        RegCopyTextField.setText(""+LonedCopy.getCopyId());
     
       RegAuthorTextField.setText(""+LonedCopy.getMyPub().getAuthor()); 
      
      }    
        else
      {
      JOptionPane.showMessageDialog(this,"Sorry, All copies are checked out. Make Resevation. ",null,WIDTH);
       ReserveButton.setVisible(true);
       RegResservationButton.setVisible(false);
       RegistrationIssueDateTextField.setVisible(false);
       issueLable.setVisible(false);
       
      }
        // TODO add your handling code here:
    }//GEN-LAST:event_RegAvilablityButtonActionPerformed

    private void RegResservationButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_RegResservationButtonActionPerformed
    // myCopy.setIsAvailable(false); 
        LoonissueDate=RegDueDateTextField.getText();
          LoonDueDate=RegistrationIssueDateTextField.getText();
          
       Loan myLoan1=new Loan(LoonissueDate,LoonDueDate,LonedMember,LonedCopy);
            myLoan.add(myLoan1);
            cleanLaon();
             JOptionPane.showMessageDialog(this,"Succesfully Borrowed ",null,WIDTH);
           // HistoryLon.addToHistory(myLoan1);
        // TODO add your handling code here:
    }//GEN-LAST:event_RegResservationButtonActionPerformed

    private void ReserveButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ReserveButtonActionPerformed
       //LoonissueDate=RegDueDateTextField.getText();
          LoonDueDate=RegistrationIssueDateTextField.getText();
          
       Reservation myReservation=new Reservation(myMember,myPublication);
             myReservationList.add(myReservation);
             cleanLaon();
             JOptionPane.showMessageDialog(this,"Succesfully Reserved ",null,WIDTH);
             // TODO add your handling code here:
    }//GEN-LAST:event_ReserveButtonActionPerformed

    private void ShowButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ShowButtonActionPerformed
    
        int id=Integer.parseInt(HistoryUserId.getText());
          Loan MemberLoan=searchHistory(id); 
          if(MemberLoan!=null)
          {
              MemberNameLabelHistory.setText(MemberLoan.getMyMember().getfName() +"  "+MemberLoan.getMyMember().getlName());
              
              BookHistoryLabel.setText(MemberLoan.getMyCopy().getMyPub().getTitle());
              BookAuthorHistoryLabel.setText(MemberLoan.getMyCopy().getMyPub().getAuthor());
              IssueDateHisoryLabel.setText(MemberLoan.getCheckoutDate());
              DueDateHisoryLablee.setText(MemberLoan.getDueDate());
//          String Detalis=" First Name"+MemberLoan.getMyMember().getfName()+
//                  
//                  "\n Last Name "+MemberLoan.getMyMember().getlName()+""+
//                  
//                  "\n Book Title"+MemberLoan.getMyCopy().getMyPub().getTitle()+" "+
//                  
//                  "\n Book Auther"+MemberLoan.getMyCopy().getMyPub().getAuthor()+"";
//        
//         historyLable.setText(Detalis);
          }
          else
          {
          JOptionPane.showMessageDialog(this,"There is not History in out data base ",null, WIDTH);
          
          }
        
        // TODO add your handling code here:
    }//GEN-LAST:event_ShowButtonActionPerformed

    private void ClearButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ClearButtonActionPerformed
         //  historyLable.setText(Detalis);TODO add your handling code here:
         historyLable.setText("");
         HistoryUserId.setText("");
          MemberNameLabelHistory.setText("");          
              BookHistoryLabel.setText("");
              BookAuthorHistoryLabel.setText("");
              IssueDateHisoryLabel.setText("");
              DueDateHisoryLablee.setText("");
        
    }//GEN-LAST:event_ClearButtonActionPerformed

    private void HistoryUserIdActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_HistoryUserIdActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_HistoryUserIdActionPerformed

    public Loan searchHistory(int id)
    {
        Loan mySearchHistory=null;
        for(Loan hl:myLoan)
        {
          if(id==hl.getMyMeber().getId())
             mySearchHistory= hl;  
          else
              mySearchHistory=null;
        }
    return mySearchHistory;    
    }
    
    
    
    
    
    public void cleanLaon()
    {
    
    RegDueDateTextField.setText("");
    RegistrationIssueDateTextField.setText("");
    RegistrationNameTextField.setText("");
    RegLastNameTextField1.setText("");
    RegAddressTextField.setText("");
    RegCopyTextField.setText("");
     RegAuthorTextField.setText("");
     RegBookTitleTextField.setText("");
       
    }
    
    
    public Member searchMember(int Id)
    {
        Member myM=null;
    for(Member meb:myMemberList)
     {
      if(Id==meb.getId())
      {
       myM= meb;
      }
      else
      {
          myM=null;
      }
      
    }
    return myM;   
        
    }
    
    
    /**
     * @param args the command line arguments
     */
    public void cleanAddPublication()
    {
        publicationTitleTextField.setText("");
       ISBNTextField.setText("");
      publicationAutherTextField.setText("");
      datePublicationTextField.setText("");
       publicationTextField.setText("");
       copyNPublicationTextField.setText("");
       
            MagazinIssueText.setText(""); 
           }
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(MainForm.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(MainForm.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(MainForm.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(MainForm.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new MainForm().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel BookAuthorHistoryLabel;
    private javax.swing.JLabel BookHistoryLabel;
    private javax.swing.JButton ClearButton;
    private javax.swing.JLabel DueDateHisoryLablee;
    private javax.swing.JTextField HistoryUserId;
    private javax.swing.JTextField ISBNTextField;
    private javax.swing.JLabel IssueDateHisoryLabel;
    private javax.swing.JTextField MagazinIssueText;
    private javax.swing.JLabel MagazineIsuue;
    private javax.swing.JLabel MemberHistoryLabel;
    private javax.swing.JTextField MemberIdTextField;
    private javax.swing.JLabel MemberNameLabelHistory;
    private javax.swing.JTextField PhoneNumberTextBox;
    private javax.swing.JTextField RegAddressTextField;
    private javax.swing.JTextField RegAuthorTextField;
    private javax.swing.JButton RegAvilablityButton;
    private javax.swing.JTextField RegBookTitleTextField;
    private javax.swing.JTextField RegCopyTextField;
    private javax.swing.JTextField RegDueDateTextField;
    private javax.swing.JTextField RegLastNameTextField1;
    private javax.swing.JComboBox RegPublicationTypeComboBox;
    private javax.swing.JButton RegResservationButton;
    private javax.swing.JTextField RegistrationIssueDateTextField;
    private javax.swing.JTextField RegistrationNameTextField;
    private javax.swing.JButton ReserveButton;
    private javax.swing.JButton ShowButton;
    private javax.swing.JButton addMemberButton;
    private javax.swing.JButton addPublicationButton;
    private javax.swing.JTextField copyNPublicationTextField;
    private javax.swing.JTextField datePublicationTextField;
    private javax.swing.JTextField firstNameTextBox;
    private javax.swing.JLabel generatedIdLable;
    private javax.swing.JLabel historyLable;
    private javax.swing.JLabel issueLable;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel17;
    private javax.swing.JLabel jLabel18;
    private javax.swing.JLabel jLabel19;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel20;
    private javax.swing.JLabel jLabel21;
    private javax.swing.JLabel jLabel22;
    private javax.swing.JLabel jLabel23;
    private javax.swing.JLabel jLabel24;
    private javax.swing.JLabel jLabel25;
    private javax.swing.JLabel jLabel26;
    private javax.swing.JLabel jLabel27;
    private javax.swing.JLabel jLabel28;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JPanel jPanel6;
    private javax.swing.JPanel jPanel7;
    private javax.swing.JTabbedPane jTabbedPane1;
    private javax.swing.JTextField lastNameTextBox;
    private javax.swing.JLabel membNameLable;
    private javax.swing.JTextField memberAddressTextBox;
    private javax.swing.JTextField publicationAutherTextField;
    private javax.swing.JTextField publicationTextField;
    private javax.swing.JTextField publicationTitleTextField;
    private javax.swing.JComboBox typePublicationComboBox;
    // End of variables declaration//GEN-END:variables
}
